<?php
defined('SEJUJOPEFDNGJSL') or exit('Access denied');

if(!empty($_GET['did'])){
	
	$did= $_GET['did'];
	$GLOBALARR['curl'] = YMCURL.'controllist';
	$db->sitedbexec("delete from ld_user where uid = $did");

	record_log('删除管理员');
	show_automsg('删除管理员成功！',$GLOBALARR['curl']);
}

$pagecount=getnums($_GET["pagecount"],$GLOBALARR['pagecount']);
$option=getnums($_GET['option'],1);
$orderby=getnums($_GET['orderby'],1);
$quser=trim($_GET['quser']);

$tmp_arr['toption'].='<a href="'.YMCURL.'controladd" class="'.geteqval(array($option,2,'taselbtn','thabtn')).'">添加管理</a>';

$condition=' where 1=1 ';


$tmp_arr['tth']='<th>序号</th><th>会员账号</th><th width=150>角色</th><th>描述</th><th>状态</th><th>最近登录时间</th><th>最近登录IP</th><th width = 250>操作</th>';

$psql="select count(0) from ld_user $condition";
$db->query($psql,3);
$pcount=$db->fval;
$pagecount=$pagecount;   //每页条数 
$astr="&lsaction=controllist&pagecount=$pagecount&orderby=$orderby&option=$option&quser=$quser";	  //Url
$pagearr=pagelist($pagecount,$pcount,$astr);
$offset=$pagearr[1];

$sql="select * from ld_user  $condition order by uid limit $offset,$pagecount";
$db->query($sql);
$ii=0;
foreach ($db->rs as $k => $v) {
	$ii++;
	$serialid=($pagearr[2]-1)*$pagecount+$ii;
	$rm=$member->getum($v['uname'],'real_name,user_jibie');
	$adminrole=$member->getua($v['uname']);
	$zhuangtai = ($v['admin_status']==0)?'正常':'禁止';
	$tmp_arr['ttr'].='<tr class="levelcolor">
						
						<td><span  title="'.$v["id"].'">'.$serialid.'</span></td>
						<td>'.$v['uname'].'</td>
						<td>'.$adminrole['rolename'].'</td>
						<td>'.$v['depict'].'</td>
						<td>'.$zhuangtai.'</td>
						<td>'.date("Y-m-d H:i:s",$v['last_login_time']).'</td>
						<td>'.$v['loginip'].'</td>
						<td><a href= "'.YMCURL.'controledit&edid='.$v['uid'].'">修改</a>&nbsp;<a href = "'.YMCURL.'controlpass&did='.$v['uid'].'">重置密码</a>&nbsp;<a href = "'.YMCURL.'controllist&did='.$v['uid'].'">删除</a></td>
						</tr>';
}


$tmp_arr['tcount']=$pcount;
$tmp_arr['ttitle']=getmenu($GLOBALARR['menu'],'controllist');
$tmp_arr['tpage']=$pagearr[0];
admin_three($tmp_arr);

?>